<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
    <title>管理员信息</title>
    <script>
        function  gotoBd() {
            window.location="https://www.baidu.com";
        }
    </script>
</head>
<body>

<p style="text-align: right">
    <a href="toAdd.user">新增一个管理员</a>
</p>
<p>
    <form method="get" action="search.user">
    <div>
        <input type="text" name="name" value="${name}" placeholder="姓名查找"/>
        <input type="text" name="username" value="${username}" placeholder="登录名名查找"/>
        入职时间：从<input type="date" name="start" value='<fmt:formatDate value="${start}" pattern="yyyy-MM-dd"/>' placeholder="时间"/>-
        到<input type="date" name="end" value='<fmt:formatDate value="${end}" pattern="yyyy-MM-dd"/>' placeholder="时间"/>
        <input type="submit" value="搜索"/>

       <%-- <input type="button" value="去百度" onclick="gotoBd()"/>--%>
    </div>
</form>
</p>
<table border="1" cellpadding="0" cellspacing="0">
    <tr>
        <th>编号</th>
        <th>姓名</th>
        <th>手机号</th>
        <th>登录名</th>
        <th>级别</th>
        <th>入职时间</th>
        <th>操作</th>
    </tr>
    <c:forEach items="${users}" var="u">
    <tr>
        <td>${u.id}
        </td>
        <td>${u.name}
        </td>
        <td>${u.telephone}</td>
        <td>${u.username}
        </td>
        <td><%--${u.roleid}--%> ${u.rolename}</td>
        <td><fmt:formatDate value="${u.enterdate}" pattern="yyyy-MM-dd"/>
        </td>
        <td>
            <a onclick="return confirm('真的要删除码？')" href="del.user?id=${u.id}">删除</a>
            <a href="toUpdate.user?id=${u.id}">修改</a>
            <a href="#">修改密码</a>
        </td>
    </tr>
    </c:forEach>
</table>
<p style="text-align: center">
    <a href="search.user?pageNo=1&name=${name}&username=${username}&start=${start}&end=${end}name=${name}&username=${username}&start=${start}>&end=${end}">第一页</a>
    <c:if test="${pageNo>1}">
        <a href="search.user?pageNo=${pageNo-1}&name=${name}&username=${username}&start=${start}&end=${end}">上一页</a>

    </c:if>
     <input style="width:40px" value="${pageNo}"  type="number" id="go" name="goto" min="1" max="${pageNums}"/>
     <input type="button" value="Go" onclick="gotoPage()"/>

    <c:if test="${pageNo<pageNums}">
    <a href="search.user?pageNo=${pageNo+1}&name=${name}&username=${username}&start=${start}&end=${end}">下一页</a>
    </c:if>
    <a href="search.user?pageNo=${pageNums}&name=${name}&username=${username}&start=${start}&end=${end}">最后一页</a>
</p>
<script>
    function gotoPage() {
        let p=document.getElementById("go").value;
        window.location="search.user?pageNo="+p+"&name=${name}&username=${username}&start=${start}&end=${end}";
    }
</script>
</body>
</html>
